<?php
/*
|
|--------------------------------------------------------------------------
| 单页数据 公司介绍
|--------------------------------------------------------------------------
|
*/
include 'includes/common.php';
include 'ss-config.php';
//include 'includes/ss-db.php';
include 'includes/functions.php';
include 'includes/share.php';

//包含左栏数据(产品导航 最新文章 联系方式)
include 'includes/leftdata.php';


//公司介绍
$query = sprintf('SELECT PAGE_TITLE, PAGE_DESCRIPTION, PAGE_KEYWORDS, PAGE_CONTENT FROM %spages WHERE ID = 1', DB_TBL_PREFIX);

mysql_query("set names 'utf8'");
$result = mysql_query($query, $GLOBALS['DB']) or die(mysql_error($GLOBALS['DB']));

if (mysql_num_rows($result))
{
	$row = mysql_fetch_assoc($result);
	
	//定义个性化元标签
	if ($row['PAGE_TITLE']) 
	{
		$unique_title = $row['PAGE_TITLE'];
	}
	
	if ($row['PAGE_DESCRIPTION']) 
	{
		$unique_description = $row['PAGE_DESCRIPTION'];
	}
	
	if ($row['PAGE_KEYWORDS']) 
	{
		$unique_keywords = $row['PAGE_KEYWORDS'];
	}
	
	//单页内容
   $company = $row['PAGE_CONTENT'];
}

mysql_free_result($result);

//产品展示
$query = sprintf('SELECT ID, CAT_ID, PRO_NAME, PRO_PRICE, PRO_IMAGE FROM %sproducts WHERE IS_DELETE = 0 ORDER BY IS_TOP DESC, SUBMIT_DATE ASC LIMIT 0, 8', DB_TBL_PREFIX);

mysql_query("set names 'utf8'");
$result = mysql_query($query, $GLOBALS['DB']) or die(mysql_error($GLOBALS['DB']));

if (mysql_num_rows($result))
{
	$products = '<ul class="product_ul">';
		   
	while ($row = mysql_fetch_array($result))
	{
		//定义伪静态链接,包含该产品所属类别的拼音形式目录名
		switch ($row['CAT_ID'])
		{
			case '1': 
			$dirname = 'fuhejinggai';
			break;
			
			case '2': 
			$dirname = 'shuzhijinggai';
			break;
			
			case '3': 
			$dirname = 'guisujinggai';
			break;
			
			case '4': 
			$dirname = 'fangdaojinggai';
			break;
			
			case '5': 
			$dirname = 'qiumozhutiejinggai';
			break;
			
			case '6': 
			$dirname = 'shuinijinggai';
			break;
			
			case '7': 
			$dirname = 'xiaonongshuichushuikou';
			break;
			
			case '8': 
			$dirname = 'huafenchi';
			break;
			
			case '9': 
			$dirname = 'jianchajingpeijian';
			break;
			
			case '10': 
			$dirname = 'jianchajinggai';
			break;
			
			case '11': 
			$dirname = 'lingmeijinggai';
			break;
			
			case '12': 
			$dirname = 'boligangjinggai';
			break;
			
			case '13': 
			$dirname = 'xiaofangjinggai';
			break;
			
			case '14': 
			$dirname = 'tongxinjinggai';
			break;
			
			case '15': 
			$dirname = 'yushuibizi';
			break;
			
			case '16': 
			$dirname = 'digougaiban';
			break;
			
			case '17': 
			$dirname = 'digoubizi';
			break;
		}
		
		$products .= '<li>';
		$products .= '<a href="' . $dirname . '/chanpin-view-' . $row['ID'] . '.html"><img src="' . $row['PRO_IMAGE'] . '" alt="' . $row['PRO_NAME'] . '"></a>';
		$products .= '<a href="' . $dirname . '/chanpin-view-' . $row['ID'] . '.html">' . $row['PRO_NAME'] . '</a>';
		$products .= '</li>';
	
	}
	
	$products .= '</ul>';
}
else
{
	$products = '';
}

mysql_free_result($result);


//调用公司介绍页模板
include 'templates/gongsi.php';
?>